Page({
	data: {
		markers: [],
		scale: 13,
		location: {
			latitude: '',
      longitude: ''
		},
		percent: 100
  },
  onLoad: function (options) {
		const query = JSON.parse(decodeURIComponent(options.query))
		let change  = this.bMapTransQQMap(query.map_lng, query.map_lat)
    const map_lat = Number(change.lat)
    const map_lng = Number(change.lng)
    const that = this
    that.setData({
      location: {
        latitude: map_lat,
				longitude: map_lng,
			},
			markers: [
				{
					callout: {
						content: query.borough_name,
						padding: 10,
						borderRadius: 2,
						display: 'ALWAYS'
					},
					latitude: map_lat,
					longitude: map_lng,
					iconPath: './imgs/Marker1_Activated@3x.png',
					width: '34px',
					height: '34px',
					rotate: 0,
					alpha: 1
				}
			]
    })
	},
	bMapTransQQMap(lng, lat) {
		let x_pi = 3.14159265358979324 * 3000.0 / 180.0;
		let x = lng - 0.0065;
		let y = lat - 0.006;
		let z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
		let theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
		let lngs = z * Math.cos(theta);
		let lats = z * Math.sin(theta);
		
		return {
			lng: lngs,
			lat: lats        
		}   
	}
})
